{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### create a Pivot table with multiple indexes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>OrderDate</th>\n",
       "      <th>Region</th>\n",
       "      <th>Manager</th>\n",
       "      <th>SalesMan</th>\n",
       "      <th>Item</th>\n",
       "      <th>Units</th>\n",
       "      <th>Unit_price</th>\n",
       "      <th>Sale_amt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2018-01-06</td>\n",
       "      <td>East</td>\n",
       "      <td>Martha</td>\n",
       "      <td>Alexander</td>\n",
       "      <td>Television</td>\n",
       "      <td>95.0</td>\n",
       "      <td>1198.0</td>\n",
       "      <td>113810.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2018-01-23</td>\n",
       "      <td>Central</td>\n",
       "      <td>Hermann</td>\n",
       "      <td>Shelli</td>\n",
       "      <td>Home Theater</td>\n",
       "      <td>50.0</td>\n",
       "      <td>500.0</td>\n",
       "      <td>25000.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2018-02-09</td>\n",
       "      <td>Central</td>\n",
       "      <td>Hermann</td>\n",
       "      <td>Luis</td>\n",
       "      <td>Television</td>\n",
       "      <td>36.0</td>\n",
       "      <td>1198.0</td>\n",
       "      <td>43128.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2018-02-26</td>\n",
       "      <td>Central</td>\n",
       "      <td>Timothy</td>\n",
       "      <td>David</td>\n",
       "      <td>Cell Phone</td>\n",
       "      <td>27.0</td>\n",
       "      <td>225.0</td>\n",
       "      <td>6075.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2018-03-15</td>\n",
       "      <td>West</td>\n",
       "      <td>Timothy</td>\n",
       "      <td>Stephen</td>\n",
       "      <td>Television</td>\n",
       "      <td>56.0</td>\n",
       "      <td>1198.0</td>\n",
       "      <td>67088.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   OrderDate   Region  Manager   SalesMan          Item  Units  Unit_price  \\\n",
       "0 2018-01-06     East   Martha  Alexander    Television   95.0      1198.0   \n",
       "1 2018-01-23  Central  Hermann     Shelli  Home Theater   50.0       500.0   \n",
       "2 2018-02-09  Central  Hermann       Luis    Television   36.0      1198.0   \n",
       "3 2018-02-26  Central  Timothy      David    Cell Phone   27.0       225.0   \n",
       "4 2018-03-15     West  Timothy    Stephen    Television   56.0      1198.0   \n",
       "\n",
       "   Sale_amt  \n",
       "0  113810.0  \n",
       "1   25000.0  \n",
       "2   43128.0  \n",
       "3    6075.0  \n",
       "4   67088.0  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_excel('SaleData.xlsx')\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>Sale_amt</th>\n",
       "      <th>Unit_price</th>\n",
       "      <th>Units</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Region</th>\n",
       "      <th>SalesMan</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"6\" valign=\"top\">Central</th>\n",
       "      <th>David</th>\n",
       "      <td>28191.000000</td>\n",
       "      <td>724.200000</td>\n",
       "      <td>42.600000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>John</th>\n",
       "      <td>41338.666667</td>\n",
       "      <td>607.666667</td>\n",
       "      <td>52.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Luis</th>\n",
       "      <td>41274.600000</td>\n",
       "      <td>690.900000</td>\n",
       "      <td>56.200000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Shelli</th>\n",
       "      <td>8424.500000</td>\n",
       "      <td>185.500000</td>\n",
       "      <td>48.250000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Sigal</th>\n",
       "      <td>41679.166667</td>\n",
       "      <td>585.500000</td>\n",
       "      <td>57.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Steven</th>\n",
       "      <td>49922.500000</td>\n",
       "      <td>1023.500000</td>\n",
       "      <td>45.750000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">East</th>\n",
       "      <th>Alexander</th>\n",
       "      <td>29587.875000</td>\n",
       "      <td>529.750000</td>\n",
       "      <td>49.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Diana</th>\n",
       "      <td>18050.000000</td>\n",
       "      <td>362.500000</td>\n",
       "      <td>62.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Karen</th>\n",
       "      <td>16068.000000</td>\n",
       "      <td>261.166667</td>\n",
       "      <td>56.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">West</th>\n",
       "      <th>Michael</th>\n",
       "      <td>33418.000000</td>\n",
       "      <td>849.000000</td>\n",
       "      <td>44.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Stephen</th>\n",
       "      <td>22015.750000</td>\n",
       "      <td>512.000000</td>\n",
       "      <td>35.500000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                       Sale_amt   Unit_price      Units\n",
       "Region  SalesMan                                       \n",
       "Central David      28191.000000   724.200000  42.600000\n",
       "        John       41338.666667   607.666667  52.000000\n",
       "        Luis       41274.600000   690.900000  56.200000\n",
       "        Shelli      8424.500000   185.500000  48.250000\n",
       "        Sigal      41679.166667   585.500000  57.666667\n",
       "        Steven     49922.500000  1023.500000  45.750000\n",
       "East    Alexander  29587.875000   529.750000  49.500000\n",
       "        Diana      18050.000000   362.500000  62.500000\n",
       "        Karen      16068.000000   261.166667  56.666667\n",
       "West    Michael    33418.000000   849.000000  44.500000\n",
       "        Stephen    22015.750000   512.000000  35.500000"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(df,index=[\"Region\",\"SalesMan\"])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### create a Pivot table and find the total sale amount region wise, manager wise"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>Sale_amt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Region</th>\n",
       "      <th>Manager</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">Central</th>\n",
       "      <th>Douglas</th>\n",
       "      <td>124016.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Hermann</th>\n",
       "      <td>365108.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Martha</th>\n",
       "      <td>199690.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Timothy</th>\n",
       "      <td>140955.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">East</th>\n",
       "      <th>Douglas</th>\n",
       "      <td>48204.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Martha</th>\n",
       "      <td>272803.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">West</th>\n",
       "      <th>Douglas</th>\n",
       "      <td>66836.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Timothy</th>\n",
       "      <td>88063.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 Sale_amt\n",
       "Region  Manager          \n",
       "Central Douglas  124016.0\n",
       "        Hermann  365108.5\n",
       "        Martha   199690.0\n",
       "        Timothy  140955.0\n",
       "East    Douglas   48204.0\n",
       "        Martha   272803.0\n",
       "West    Douglas   66836.0\n",
       "        Timothy   88063.0"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(df,index = [\"Region\",\"Manager\"], values = [\"Sale_amt\"],aggfunc=np.sum)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### create a Pivot table and find the total sale amount region wise, manager wise, sales man wise"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>Sale_amt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Region</th>\n",
       "      <th>Manager</th>\n",
       "      <th>SalesMan</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"6\" valign=\"top\">Central</th>\n",
       "      <th>Douglas</th>\n",
       "      <th>John</th>\n",
       "      <td>124016.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">Hermann</th>\n",
       "      <th>Luis</th>\n",
       "      <td>206373.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Shelli</th>\n",
       "      <td>33698.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Sigal</th>\n",
       "      <td>125037.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Martha</th>\n",
       "      <th>Steven</th>\n",
       "      <td>199690.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Timothy</th>\n",
       "      <th>David</th>\n",
       "      <td>140955.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">East</th>\n",
       "      <th>Douglas</th>\n",
       "      <th>Karen</th>\n",
       "      <td>48204.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">Martha</th>\n",
       "      <th>Alexander</th>\n",
       "      <td>236703.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Diana</th>\n",
       "      <td>36100.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">West</th>\n",
       "      <th>Douglas</th>\n",
       "      <th>Michael</th>\n",
       "      <td>66836.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Timothy</th>\n",
       "      <th>Stephen</th>\n",
       "      <td>88063.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                           Sale_amt\n",
       "Region  Manager SalesMan           \n",
       "Central Douglas John       124016.0\n",
       "        Hermann Luis       206373.0\n",
       "                Shelli      33698.0\n",
       "                Sigal      125037.5\n",
       "        Martha  Steven     199690.0\n",
       "        Timothy David      140955.0\n",
       "East    Douglas Karen       48204.0\n",
       "        Martha  Alexander  236703.0\n",
       "                Diana       36100.0\n",
       "West    Douglas Michael     66836.0\n",
       "        Timothy Stephen     88063.0"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(df,index=[\"Region\",\"Manager\",\"SalesMan\"], values=\"Sale_amt\", aggfunc=np.sum)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### create a Pivot table and find the item wise unit sold"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Units</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Item</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Cell Phone</th>\n",
       "      <td>278.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Desk</th>\n",
       "      <td>10.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Home Theater</th>\n",
       "      <td>722.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Television</th>\n",
       "      <td>716.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Video Games</th>\n",
       "      <td>395.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              Units\n",
       "Item               \n",
       "Cell Phone    278.0\n",
       "Desk           10.0\n",
       "Home Theater  722.0\n",
       "Television    716.0\n",
       "Video Games   395.0"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(df,index=[\"Item\"], values=\"Units\", aggfunc=np.sum)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### find the region wise total sale."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Sale_amt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Region</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Central</th>\n",
       "      <td>829769.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>East</th>\n",
       "      <td>321007.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>West</th>\n",
       "      <td>154899.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         Sale_amt\n",
       "Region           \n",
       "Central  829769.5\n",
       "East     321007.0\n",
       "West     154899.0"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(df,index=\"Region\",values=\"Sale_amt\", aggfunc = np.sum)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### region wise, item wise unit sold"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>Units</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Region</th>\n",
       "      <th>Item</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"5\" valign=\"top\">Central</th>\n",
       "      <th>Cell Phone</th>\n",
       "      <td>27.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Desk</th>\n",
       "      <td>7.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Home Theater</th>\n",
       "      <td>424.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Television</th>\n",
       "      <td>498.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Video Games</th>\n",
       "      <td>243.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">East</th>\n",
       "      <th>Cell Phone</th>\n",
       "      <td>175.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Home Theater</th>\n",
       "      <td>234.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Television</th>\n",
       "      <td>130.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Video Games</th>\n",
       "      <td>152.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">West</th>\n",
       "      <th>Cell Phone</th>\n",
       "      <td>76.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Desk</th>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Home Theater</th>\n",
       "      <td>64.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Television</th>\n",
       "      <td>88.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                      Units\n",
       "Region  Item               \n",
       "Central Cell Phone     27.0\n",
       "        Desk            7.0\n",
       "        Home Theater  424.0\n",
       "        Television    498.0\n",
       "        Video Games   243.0\n",
       "East    Cell Phone    175.0\n",
       "        Home Theater  234.0\n",
       "        Television    130.0\n",
       "        Video Games   152.0\n",
       "West    Cell Phone     76.0\n",
       "        Desk            3.0\n",
       "        Home Theater   64.0\n",
       "        Television     88.0"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(df,index=[\"Region\", \"Item\"], values=\"Units\", aggfunc=np.sum)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### create a Pivot table and count the manager wise sale and mean value of sale amount"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th>mean</th>\n",
       "      <th>len</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th>Sale_amt</th>\n",
       "      <th>Sale_amt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Manager</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Douglas</th>\n",
       "      <td>29882.000000</td>\n",
       "      <td>8.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Hermann</th>\n",
       "      <td>30425.708333</td>\n",
       "      <td>12.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Martha</th>\n",
       "      <td>33749.500000</td>\n",
       "      <td>14.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Timothy</th>\n",
       "      <td>25446.444444</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 mean      len\n",
       "             Sale_amt Sale_amt\n",
       "Manager                       \n",
       "Douglas  29882.000000      8.0\n",
       "Hermann  30425.708333     12.0\n",
       "Martha   33749.500000     14.0\n",
       "Timothy  25446.444444      9.0"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(df,index=[\"Manager\"],values=[\"Sale_amt\"],aggfunc=[np.mean,len])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### create a Pivot table and find manager wise, salesman wise total sale and also display the sum of all sale amount at the bottom"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th colspan=\"2\" halign=\"left\">sum</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>Sale_amt</th>\n",
       "      <th>Units</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Manager</th>\n",
       "      <th>SalesMan</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">Douglas</th>\n",
       "      <th>John</th>\n",
       "      <td>124016.0</td>\n",
       "      <td>156</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Karen</th>\n",
       "      <td>48204.0</td>\n",
       "      <td>170</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Michael</th>\n",
       "      <td>66836.0</td>\n",
       "      <td>89</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">Hermann</th>\n",
       "      <th>Luis</th>\n",
       "      <td>206373.0</td>\n",
       "      <td>281</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Shelli</th>\n",
       "      <td>33698.0</td>\n",
       "      <td>193</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Sigal</th>\n",
       "      <td>125037.5</td>\n",
       "      <td>173</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">Martha</th>\n",
       "      <th>Alexander</th>\n",
       "      <td>236703.0</td>\n",
       "      <td>396</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Diana</th>\n",
       "      <td>36100.0</td>\n",
       "      <td>125</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Steven</th>\n",
       "      <td>199690.0</td>\n",
       "      <td>183</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">Timothy</th>\n",
       "      <th>David</th>\n",
       "      <td>140955.0</td>\n",
       "      <td>213</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Stephen</th>\n",
       "      <td>88063.0</td>\n",
       "      <td>142</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>All</th>\n",
       "      <th></th>\n",
       "      <td>1305675.5</td>\n",
       "      <td>2121</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                         sum      \n",
       "                    Sale_amt Units\n",
       "Manager SalesMan                  \n",
       "Douglas John        124016.0   156\n",
       "        Karen        48204.0   170\n",
       "        Michael      66836.0    89\n",
       "Hermann Luis        206373.0   281\n",
       "        Shelli       33698.0   193\n",
       "        Sigal       125037.5   173\n",
       "Martha  Alexander   236703.0   396\n",
       "        Diana        36100.0   125\n",
       "        Steven      199690.0   183\n",
       "Timothy David       140955.0   213\n",
       "        Stephen      88063.0   142\n",
       "All                1305675.5  2121"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "table = pd.pivot_table(df,index=[\"Manager\",\"SalesMan\"],values=[\"Units\",\"Sale_amt\"],\n",
    "               aggfunc=[np.sum],fill_value=0,margins=True)\n",
    "\n",
    "table"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### create a Pivot table and find the total sale amount region wise, manager wise, sales man wise where Manager = \"Douglas\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>Sale_amt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Region</th>\n",
       "      <th>Manager</th>\n",
       "      <th>SalesMan</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"6\" valign=\"top\">Central</th>\n",
       "      <th>Douglas</th>\n",
       "      <th>John</th>\n",
       "      <td>41338.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">Hermann</th>\n",
       "      <th>Luis</th>\n",
       "      <td>41274.600000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Shelli</th>\n",
       "      <td>8424.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Sigal</th>\n",
       "      <td>41679.166667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Martha</th>\n",
       "      <th>Steven</th>\n",
       "      <td>49922.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Timothy</th>\n",
       "      <th>David</th>\n",
       "      <td>28191.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">East</th>\n",
       "      <th>Douglas</th>\n",
       "      <th>Karen</th>\n",
       "      <td>16068.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">Martha</th>\n",
       "      <th>Alexander</th>\n",
       "      <td>29587.875000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Diana</th>\n",
       "      <td>18050.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">West</th>\n",
       "      <th>Douglas</th>\n",
       "      <th>Michael</th>\n",
       "      <td>33418.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Timothy</th>\n",
       "      <th>Stephen</th>\n",
       "      <td>22015.750000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                               Sale_amt\n",
       "Region  Manager SalesMan               \n",
       "Central Douglas John       41338.666667\n",
       "        Hermann Luis       41274.600000\n",
       "                Shelli      8424.500000\n",
       "                Sigal      41679.166667\n",
       "        Martha  Steven     49922.500000\n",
       "        Timothy David      28191.000000\n",
       "East    Douglas Karen      16068.000000\n",
       "        Martha  Alexander  29587.875000\n",
       "                Diana      18050.000000\n",
       "West    Douglas Michael    33418.000000\n",
       "        Timothy Stephen    22015.750000"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "table = pd.pivot_table(df,index=[\"Region\",\"Manager\",\"SalesMan\"], values=\"Sale_amt\")\n",
    "table"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>Sale_amt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Region</th>\n",
       "      <th>Manager</th>\n",
       "      <th>SalesMan</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Central</th>\n",
       "      <th>Douglas</th>\n",
       "      <th>John</th>\n",
       "      <td>41338.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>East</th>\n",
       "      <th>Douglas</th>\n",
       "      <th>Karen</th>\n",
       "      <td>16068.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>West</th>\n",
       "      <th>Douglas</th>\n",
       "      <th>Michael</th>\n",
       "      <td>33418.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                              Sale_amt\n",
       "Region  Manager SalesMan              \n",
       "Central Douglas John      41338.666667\n",
       "East    Douglas Karen     16068.000000\n",
       "West    Douglas Michael   33418.000000"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "table.query('Manager == [\"Douglas\"]')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### create a Pivot table and find the region wise Television and Home Theater sold"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>Units</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Region</th>\n",
       "      <th>Item</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"5\" valign=\"top\">Central</th>\n",
       "      <th>Cell Phone</th>\n",
       "      <td>27.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Desk</th>\n",
       "      <td>3.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Home Theater</th>\n",
       "      <td>53.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Television</th>\n",
       "      <td>55.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Video Games</th>\n",
       "      <td>60.750000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">East</th>\n",
       "      <th>Cell Phone</th>\n",
       "      <td>58.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Home Theater</th>\n",
       "      <td>46.800000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Television</th>\n",
       "      <td>65.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Video Games</th>\n",
       "      <td>50.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">West</th>\n",
       "      <th>Cell Phone</th>\n",
       "      <td>76.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Desk</th>\n",
       "      <td>3.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Home Theater</th>\n",
       "      <td>32.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Television</th>\n",
       "      <td>44.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                          Units\n",
       "Region  Item                   \n",
       "Central Cell Phone    27.000000\n",
       "        Desk           3.500000\n",
       "        Home Theater  53.000000\n",
       "        Television    55.333333\n",
       "        Video Games   60.750000\n",
       "East    Cell Phone    58.333333\n",
       "        Home Theater  46.800000\n",
       "        Television    65.000000\n",
       "        Video Games   50.666667\n",
       "West    Cell Phone    76.000000\n",
       "        Desk           3.000000\n",
       "        Home Theater  32.000000\n",
       "        Television    44.000000"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "table = pd.pivot_table(df,index=[\"Region\", \"Item\"], values=\"Units\")\n",
    "table"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>Units</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Region</th>\n",
       "      <th>Item</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">Central</th>\n",
       "      <th>Home Theater</th>\n",
       "      <td>53.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Television</th>\n",
       "      <td>55.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">East</th>\n",
       "      <th>Home Theater</th>\n",
       "      <td>46.800000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Television</th>\n",
       "      <td>65.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">West</th>\n",
       "      <th>Home Theater</th>\n",
       "      <td>32.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Television</th>\n",
       "      <td>44.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                          Units\n",
       "Region  Item                   \n",
       "Central Home Theater  53.000000\n",
       "        Television    55.333333\n",
       "East    Home Theater  46.800000\n",
       "        Television    65.000000\n",
       "West    Home Theater  32.000000\n",
       "        Television    44.000000"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "table.query('Item == [\"Television\",\"Home Theater\"]')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### create a Pivot table and find the minimum sale value of the items"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Sale_amt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Item</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Cell Phone</th>\n",
       "      <td>3375.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Desk</th>\n",
       "      <td>250.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Home Theater</th>\n",
       "      <td>2000.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Television</th>\n",
       "      <td>8386.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Video Games</th>\n",
       "      <td>936.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              Sale_amt\n",
       "Item                  \n",
       "Cell Phone      3375.0\n",
       "Desk             250.0\n",
       "Home Theater    2000.0\n",
       "Television      8386.0\n",
       "Video Games      936.0"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "table = pd.pivot_table(df, index='Item', values='Sale_amt', aggfunc=np.min)\n",
    "table"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
